<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'amanagnergrade.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
 	<script language="javascript">
           function adminDel(userId)
           {
               if(confirm('您确定删除吗？'))
               {	
              
                   window.location.href="<%=path %>/servlet/DeleteGrade?userId="+userId;
               }
           }
			function query() {
				if(document.getElementById("id").value == "") {
					alert("请输入要查询的学生名称");
					return false;
				}
				return true;
			}
	 </script>
</head>
<body leftmargin="2" topmargin="2" >
  <table>
			<form action="<%=path %>/servlet/GradeInfoById" name="formUpdata" method="post">
				<tr>
					学生成绩查询
				</tr>
				<tr>
					<td width="25%" bgcolor="#FFFFFF" align="right">请输入学生的姓名</td>
					<td width="75%" bgcolor="#FFFFFF" align="left">
						<input type="text" name="id" id="id" size="20" />
						<input type="submit" value="提交" onClick="return query();" />&nbsp;
					</td>
				</tr>
			</form>
		</table>
		<h1>${meessage}</h1>
			<table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">
				<tr bgcolor="#E7E7E7">
					<td height="14" colspan="6" align='center'>&nbsp;学生成绩&nbsp;</td>
				</tr>
				<tr align="center" bgcolor="#FAFAF1" height="22">
					<td width="10%">ID</td>
					<td width="10%">学生名</td>
					<td width="10%">课程名</td>
					<td width="10%">任课老师</td>
					<td width="10%">学分</td>
					<td width="10%">分数</td>
					<td width="10%">操作</td>
		        </tr>	
				<c:forEach items="${grade}" var="s">
				<tr align='center' bgcolor="#FFFFFF" height="22">
					<td bgcolor="#FFFFFF" align="center">
						${s.g_id}
					</td>
					<td bgcolor="#FFFFFF" align="center">
						${s.username}
					</td>
					<td bgcolor="#FFFFFF" align="center">
					    ${s.c_name}
					</td>
					<td bgcolor="#FFFFFF" align="center">
					   ${s.teacher}
					</td>
					<td bgcolor="#FFFFFF" align="center">
					    ${s.score}
					</td>
					<td bgcolor="#FFFFFF" align="center">
					    ${s.grade}
					</td>
					<td bgcolor="#FFFFFF" align="center">
						<a href="#" onclick="adminDel(${s.g_id})" >删除</a>
						<a href="<%=path %>/servlet/UpdateGradeT?username=${s.username}">修改</a>
					</td>
				</tr>
				</c:forEach>
			</table>
		    
  </body>
</html>
